home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 September / PCWorld_2008-09_cd.bin / v cisle / sadanastroju / delicious_bookmarks-2.0.64-fx.xpi / chrome / deliciousBookmarks.jar / content / imageTip.xml < prev    next >
Encoding:
Extensible Markup Language  |  2008-06-19  |  2.8 KB  |  79 lines

  1. <?xml version="1.0"?>
  2.  
  3. <bindings xmlns="http://www.mozilla.org/xbl"
  4.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  5.           xmlns:xbl="http://www.mozilla.org/xbl">
  6.  
  7.   <binding id="imageTip">
  8.  
  9.     <resources>
  10.       <stylesheet src="chrome://ybookmarks/skin/imageTip.css" />
  11.     </resources>
  12.  
  13.     <implementation>
  14.       <constructor>
  15.         <![CDATA[
  16.           var vbox = document.getAnonymousElementByAttribute( this, "anonid", "tipBox" );
  17.           var hdrText = vbox.getAttribute( "tipHeader" );
  18.           if( hdrText.length > 0 ) {
  19.             var hdrLabel = document.createElement( "label" );
  20.             hdrLabel.setAttribute( "value", hdrText );
  21.             hdrLabel.setAttribute( "class", "tipHeader" );
  22.             vbox.appendChild( hdrLabel );
  23.           }           
  24.           var contentText = vbox.getAttribute( "tipContent" );
  25.           if( contentText.length > 0 ) {
  26.             var words = contentText.split( ' ' );
  27.             var i, text = "", lbl, createLabel, wordIncluded, desc;
  28.             var wordSpc;
  29.             for( i = 0; i < words.length; ++i ) {
  30.               wordIncluded = createLabel = false;
  31.               if( text.length + words[ i ].length <= 31 ) {
  32.                 wordIncluded = true;
  33.                 if( text.length > 0 ) {
  34.                   text += ' ';
  35.                 }
  36.                 text += words[ i ];
  37.                 if( i == words.length - 1 ) {       // it's the last word anyway
  38.                   createLabel = true;
  39.                 }
  40.               }
  41.               else {
  42.                 createLabel = true;
  43.               }
  44.               if( createLabel ) {
  45.                 lbl = document.createElement( "label" );
  46.                 lbl.setAttribute( "value", text );
  47.                 vbox.appendChild( lbl );
  48.                 if( ( !wordIncluded ) && ( i == words.length - 1 ) ) {      
  49.                   // last word will be picked up in re-iteration
  50.                   --i;
  51.                   text = "";
  52.                   continue;
  53.                 }
  54.                 text = words[ i ];
  55.               }
  56.             }
  57.           }
  58.         ]]>  
  59.       </constructor>
  60.       <method name="tipImageClicked">
  61.         <body><![CDATA[
  62.           var tooltip = document.getAnonymousElementByAttribute( this, "anonid", "tooltip" );
  63.           tooltip.showPopup( tooltip, this.boxObject.screenX, this.boxObject.screenY );
  64.          ]]></body>
  65.       </method>
  66.     </implementation>
  67.     
  68.     <content>
  69.       <children />
  70.       <xul:hbox tooltip="_child" align="center">
  71.         <xul:image src="chrome://ybookmarks/skin/questionMark.gif" onclick="tipImageClicked();"/>
  72.         <xul:tooltip anonid="tooltip">
  73.           <xul:vbox anonid="tipBox" xbl:inherits="tipHeader,tipContent" />
  74.         </xul:tooltip>
  75.       </xul:hbox>
  76.     </content>
  77.   </binding>
  78. </bindings>
  79.